import request from '@/utils/request'
import request_tonji from '@/utils/request_tonji'

//获取广告配置列表
export function getConfigList(query) {
  return request({
    url: '/api/adv/config',
    method: 'get',
    params: query
  })
}

// 获取广告配置修改记录
export function getConfigLog(query) {
  return request({
    url: '/api/adv/config/log',
    method: 'get',
    params: query
  })
}

// 创建广告配置
export function createConfig(data) {
    return request({
        url: '/api/adv/config',
        method: 'post',
        data: data
    })
}

// 修改广告配置
export function updateConfig(data) {
    return request({
        url: '/api/adv/config',
        method: 'put',
        data: data
    })
}

// 系统错误 废弃
export function getErrorReport(query) {
  return request_tonji({
      url: '/api/app/error',
      method: 'get',
      params: query
  })
}

// 广告请求错误统计
export function getAdvRequestError(query) {
  return request_tonji({
      url: '/api/adv/request/error',
      method: 'get',
      params: query
  })
}

// 广告请求错误详情
export function getAdvRequestErrorInfo(query) {
  return request_tonji({
      url: '/api/adv/request/error/info',
      method: 'get',
      params: query
  })
}

// 广告展示错误统计
export function getAdvShowError(query) {
  return request_tonji({
      url: '/api/adv/show/error',
      method: 'get',
      params: query
  })
}

// 广告展示错误详情
export function getAdvShowInfoError(query) {
  return request_tonji({
      url: '/api/adv/show/error/info',
      method: 'get',
      params: query
  })
}


// 广告模板列表
export function getAdvTemplate(query) {
  return request({
      url: '/api/adv/template',
      method: 'get',
      params: query
  })
}
// 创建广告模板
export function createAdvTemplate(data) {
  return request({
      url: '/api/adv/template',
      method: 'post',
      data: data
  })
}
// 修改广告模板
export function updateAdvTemplate(data) {
  return request({
      url: '/api/adv/template',
      method: 'put',
      data: data
  })
}

// 删除广告模板
export function delAdvTemplate(query) {
  return request({
      url: '/api/adv/template',
      method: 'delete',
      params: query
  })
}

// 配置 列表
export function getAdvConfig(query) {
  return request({
      url: '/api/adv/config',
      method: 'get',
      params: query
  })
}
export function createAdvConfig(data) {
  return request({
      url: '/api/adv/config',
      method: 'post',
      data: data
  })
}

export function updateAdvConfig(data) {
  return request({
      url: '/api/adv/config',
      method: 'put',
      data: data
  })
}

// 广告id
export function getAdvId(query) {
  return request({
      url: '/api/adv/id',
      method: 'get',
      params: query
  })
}

export function createAdvId(data) {
  return request({
      url: '/api/adv/id',
      method: 'post',
      data: data
  })
}

export function updateAdvId(data) {
  return request({
      url: '/api/adv/id',
      method: 'put',
      data: data
  })
}


// 城市黑名单
export function getCity() {
  return request({
      url: '/api/black/city',
      method: 'get',
  })
}

export function createCity(data) {
  return request({
      url: '/api/black/city',
      method: 'put',
      data: data
  })
}

export function delCity(query) {
  return request({
      url: '/api/black/city',
      method: 'delete',
      params: query
  })
}

// 广告位点击统计
export function getTemplateReport(query) {
  return request_tonji({
      url: '/api/template/click/report',
      method: 'get',
      params: query
  })
}

// 获取包列表，用于下拉选框之类的
export function getPkgList(query) {
  return request({
      url: '/api/pkg/list',
      method: 'get',
      params: query
  })
}

// 回拉代码
export function getPullBack() {
  return request({
      url: '/api/pull/back',
      method: 'get',
  })
}
export function createPullBack(data) {
  return request({
      url: '/api/pull/back',
      method: 'post',
      data: data
  })
}
export function updatePullBack(data) {
  return request({
      url: '/api/pull/back',
      method: 'put',
      data: data
  })
}
export function delPullBack(params) {
  return request({
      url: '/api/pull/back',
      method: 'delete',
      params: params
  })
}


// 安装包黑名单
export function getInstallPkg() {
  return request({
      url: '/api/black/pkg',
      method: 'get',
  })
}

export function createInstallPkg(data) {
  return request({
      url: '/api/black/pkg',
      method: 'put',
      data: data
  })
}

export function delInstallPkg(query) {
  return request({
      url: '/api/black/pkg',
      method: 'delete',
      params: query
  })
}

// 剪切板敏感词
export function getCut() {
  return request({
      url: '/api/black/cut',
      method: 'get',
  })
}

export function createCut(data) {
  return request({
      url: '/api/black/cut',
      method: 'put',
      data: data
  })
}

export function delCut(query) {
  return request({
      url: '/api/black/cut',
      method: 'delete',
      params: query
  })
}

// 网站配置
export function getWebSetting() {
  return request({
      url: '/api/web/set',
      method: 'get',
  })
}

export function updateWebSetting(data) {
  return request({
      url: '/api/web/set',
      method: 'put',
      data: data
  })
}

// 拉起app来源
export function getPullSource(params) {
  return request({
      url: '/api/pull/source',
      method: 'get',
      params: params
  })
}


// 口令
export function getkouling(params) {
  return request({
      url: '/api/kouling',
      method: 'get',
      params: params
  })
}

export function updatekouling(data) {
  return request({
      url: '/api/kouling',
      method: 'post',
      data: data
  })
}

// 广告展示点击详细
export function advInfo(params) {
  return request_tonji({
      url: '/api/adv/info',
      method: 'get',
      params: params
  })
}
// 每个用户点击广告数量
export function advUserClickSum(params) {
  return request_tonji({
      url: '/api/user/click',
      method: 'get',
      params: params
  })
}

// 未展示广告和点击的用户
export function advNoUserClickSum(params) {
  return request_tonji({
      url: '/api/no/user/click',
      method: 'get',
      params: params
  })
}

// 拉起app来源
export function getPullType(params) {
  return request({
      url: '/api/pull/type',
      method: 'get',
      params: params
  })
}

// 广告预展示率
export function getAdcShow(params) {
  return request_tonji({
      url: '/api/adv/show',
      method: 'get',
      params: params
  })
}

// 包版本统计
export function getPkgV(params) {
  return request({
      url: '/api/pkg/v',
      method: 'get',
      params: params
  })
}

// 安卓版本统计
export function getAndroidV(params) {
  return request({
      url: '/api/android/v',
      method: 'get',
      params: params
  })
}

// 用户设备查询
export function getUserDevrice(params) {
  return request({
      url: '/api/user/search',
      method: 'get',
      params: params
  })
}

// 查询用户oaid是空的
export function getOaidNull(params) {
  return request({
      url: '/api/oaid/null',
      method: 'get',
      params: params
  })
}

// 广告第一次打开的时间
export function getAdvFirstShow(params) {
  return request_tonji({
      url: '/api/adv/first/show/time',
      method: 'get',
      params: params
  })
}

// 用户应用平均时长
export function getUsageTime(params) {
  return request_tonji({
      url: '/api/app/usage/time',
      method: 'get',
      params: params
  })
}

// 获取ip位置错误次数
export function getIpError(params) {
  return request_tonji({
      url: '/api/ip/error',
      method: 'get',
      params: params
  })
}

// 获取广告配置花费的时间
export function getAdvConfigTime(params) {
  return request_tonji({
      url: '/api/get/adv/config/time',
      method: 'get',
      params: params
  })
}


// 获取用户使用时间
export function getUsageTimeInfo(params) {
  return request_tonji({
      url: '/api/app/usage/time/info',
      method: 'get',
      params: params
  })
}

// 获取用户返回次数和时间
export function getUserBack(params) {
  return request_tonji({
      url: '/api/user/back',
      method: 'get',
      params: params
  })
}

// 获取广告埋点
export function getBuryingPoint(params) {
  return request_tonji({
      url: '/api/burying/point',
      method: 'get',
      params: params
  })
}